package anc.tankshooter.controls;

import org.andengine.entity.Entity;
import org.andengine.entity.primitive.Rectangle;
import org.andengine.entity.text.Text;
import org.andengine.util.color.Color;

import anc.tankshooter.ui.ResourcesManager;

public class InfoBoard extends Entity {
	
	private int mKilledNormalTank;
	private int mKilledFastTank;
	private int mKilledHeavyTank;
	private int mKilledBossTank;
	private int mScore;
	private int mHeart;
	
	private Rectangle mBackgroudRect;
	private Text mInfoText;
	
	public InfoBoard(float x,float y){
		super(x, y);
		setZIndex(1);
		mInfoText = new Text(5, 5,ResourcesManager.getInstance().mWhiteFont18,"",256, ResourcesManager.getInstance().mVertexManager);
		mBackgroudRect = new Rectangle(0, 0, mInfoText.getWidth()+10,mInfoText.getHeight()+10, ResourcesManager.getInstance().mVertexManager);
		mBackgroudRect.setColor(Color.BLACK);
		mBackgroudRect.setAlpha(0.5f);
		

		attachChild(mBackgroudRect);
		attachChild(mInfoText);
	}
	@Override
	protected void onManagedUpdate(float pSecondsElapsed) {
		mInfoText.setText(String.format("%d N - %d F - %d H\n"+
										"Score: %d\n"+
										"Life: %d",
									mKilledNormalTank,
									mKilledFastTank,
									mKilledHeavyTank,mScore,mHeart));
		mBackgroudRect.setSize( mInfoText.getWidth()+10, mInfoText.getHeight()+10);
		super.onManagedUpdate(pSecondsElapsed);
	}

	
	public int getNormalTank() {
		return mKilledNormalTank;
	}
	public void setNormalTank(int mKilledNormalTank) {
		this.mKilledNormalTank = mKilledNormalTank;
	}
	public int getFastTank() {
		return mKilledFastTank;
	}
	public void setFastTank(int mKilledFastTank) {
		this.mKilledFastTank = mKilledFastTank;
	}
	public int getHeavyTank() {
		return mKilledHeavyTank;
	}
	public void setHeavyTank(int mKilledHeavyTank) {
		this.mKilledHeavyTank = mKilledHeavyTank;
	}
	public int getBossTank() {
		return mKilledBossTank;
	}
	public void setBossTank(int mKilledBossTank) {
		this.mKilledBossTank = mKilledBossTank;
	}
	public int getScore() {
		return mScore;
	}
	public void setScore(int mScore) {
		this.mScore = mScore;
	}
	public int getHeart() {
		return mHeart;
	}
	public void setHeart(int mHeart) {
		this.mHeart = mHeart;
	}
}
